#ifndef FACEDETECTOR_H
#define FACEDETECTOR_H

#include <QMainWindow>
#include <opencv2/opencv.hpp>
#include <QTimer>

QT_BEGIN_NAMESPACE
namespace Ui {
class FaceDetector;
}
QT_END_NAMESPACE

class FaceDetector : public QMainWindow
{
    Q_OBJECT

signals:
    void back();
public:
    void getFrame();
    FaceDetector(QWidget *parent = nullptr);
    void setID(int id);
    ~FaceDetector();

private slots:
    void on_pushButton_clock_in_clicked();

    void on_pushButton_cancel_clicked();

    void on_pushButton_record_clicked();

    void on_pushButton_back_clicked();

private:
    QString fr_model;
    QString fd_model;
    cv::Ptr<cv::FaceDetectorYN> faceDetector;
    cv::Ptr<cv::FaceRecognizerSF> faceRecongnizer;
    int user_id;                //登录成功后的用户id
    cv::Mat face;               //保存一帧时刻的人脸位置
    Ui::FaceDetector *ui;
    cv::VideoCapture cap;
    QTimer* timer;
};
#endif // FACEDETECTOR_H
